<template>
    <div>
        请输入新密码：<input type="text" v-model="password">
    <br>
    <br>
    <a-form-item :label-col="formTailLayout.labelCol" :wrapper-col="formTailLayout.wrapperCol">
      <a-button type="primary" @click="update">
        修改密码
      </a-button>
    </a-form-item>
    </div>
</template>

<script>
const formTailLayout = {
  labelCol: { span: 8 },
  wrapperCol: { span: 15, offset: 4 },
};

import axios from 'axios'
export default {
    data() {
        return {
          password:'',

          uid:localStorage.getItem('uid'),
          formTailLayout,
        }
    },
    methods: {
      update(){
        axios.put('http://127.0.0.1:8000/user/update/',{'password':this.password,'uid':this.uid}).then(res=>{
          if(res.data.code==200){
            console.log(res.data)
            alert(res.data.msg)
            this.$router.push('/login')
          }
        })
      }
    },
    handleChange(e) {
      this.checkNick = e.target.checked;
      this.$nextTick(() => {
        this.form.validateFields(['nickname'], { force: true });
      });
    },
    created() {

    }
}
</script>

<style scoped>

</style>
